package com.leonzhangxf.bucksdemo.order.domain.value;

import lombok.Value;

import java.io.Serializable;
import java.time.Instant;
import java.util.Objects;

@Value
public class OrderStatusChangeLog implements Serializable {

    private static final long serialVersionUID = 1L;

    private OrderStatus beforeStatus;

    private OrderStatus afterStatus;

    private Instant changeTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OrderStatusChangeLog that = (OrderStatusChangeLog) o;
        return beforeStatus == that.beforeStatus &&
            afterStatus == that.afterStatus &&
            Objects.equals(changeTime, that.changeTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(beforeStatus, afterStatus, changeTime);
    }
}
